﻿package org.leles.engines.octogame 
{
	
	/**
	 * ...
	 * @author Bruno leles
	 */
	public class OctoGameLevel extends OctoGameObject
	{
		private var _phases:Array/*of OctoGamePhase*/;
		private var _currentPhaseIndex:int;
		
		public function OctoGameLevel() 
		{
			super();
			_phases = new Array();
			_currentPhaseIndex = -1;
		}
		
		public function gotoNextPhase():Boolean
		{
			if ( _phases[ ++_currentPhaseIndex ] )
				return true;
			
			return false;
		}
		
		public function gotoFirstPhase():Boolean 
		{
			_currentPhaseIndex = -1;
			return gotoNextPhase();
		}
		
		public function getPhase(phaseIndex:int):OctoGamePhase 
		{
			return phases[phaseIndex] as OctoGamePhase;
		}
		
		public function get phases():Array { return _phases; }
		
		public function get currentPhase():OctoGamePhase{return _phases[_currentPhaseIndex] as OctoGamePhase;}

		public function get currentPhaseIndex():uint { return _currentPhaseIndex; }
		public function set currentPhaseIndex(value:uint):void {	_currentPhaseIndex = value;	}
		
	}
	
}